import { createApp } from 'vue'
import App from '@/App.vue'
import router from '@/router'
import store from '@/store'

// @ts-ignore
import Cookies from 'vue-cookie'
import 'element-plus/dist/index.css'
import { ElMessage } from 'element-plus'
import { handleGet, handlePost, handlePut, handleDel } from '@/utils/axios'
import { setMD5 } from '@/utils/publicMetheds'
import axios from 'axios'
import '@/permission'
import '@/assets/styles/common.scss'
import HcElement from '@/components/HcElements/index'
import api from '@/api/index'

const app = createApp(App)

// 挂载到app实例上
app.config.globalProperties.$get = handleGet
app.config.globalProperties.$post = handlePost
app.config.globalProperties.$put = handlePut
app.config.globalProperties.$del = handleDel
app.config.globalProperties.$axios = axios
app.config.globalProperties.$message = ElMessage
app.config.globalProperties.$cookie = Cookies
app.config.globalProperties.$md5 = setMD5
app.config.globalProperties.$pubg = setMD5
app.config.globalProperties.$api = api

app
  // @ts-ignore
  .use(store)
  // @ts-ignore
  .use(router)
  .use(HcElement)
  .mount('#app')

export default app
